(function(){ 
    //Section 1 : 按下自定义按钮时执行的代码 
    var a= { 
        exec:function(editor){ 
    		if(editContentType==1){
    			var emailContent = editor.getData();
	            document.getElementById("emailContent").value=emailContent;
	            document.getElementById("toEmailFile").style.display="none";
	            document.getElementById("emailstatus").innerHTML = "（已完成）";
    		}else{
    			var content = editor.document.getBody().getText();
    			if(editContentType==2){
    				document.getElementById("msgContent").value=content;
    				document.getElementById("toMessageFile").style.display="none";
    				document.getElementById("smsstatus").innerHTML = "（已完成）";
    			}else{
    				document.getElementById("wxContent").value=content;
    				document.getElementById("toWXFile").style.display="none";
    				document.getElementById("wxstatus").innerHTML = "（已完成）";
    			}
    		}         
        } 
    }, 
    //Section 2 : 创建自定义按钮、绑定方法 
    b='code'; 
    CKEDITOR.plugins.add(b,{ 
        init:function(editor){ 
            editor.addCommand(b,a); 
            editor.ui.addButton('code',{ 
                label:'保存并关闭', 
                icon: this.path + 'logo_ckeditor.png', 
                command:b 
            }); 
        } 
    }); 
})();